#include <func.h>

//父子进程要查看所在的会话,子进程成立新会话
int main()
{
    pid_t pid=fork();
    if(0==pid)//子进程
    {
        printf("I am child,%d,ppid=%d,pgid=%d,sid=%d\n",getpid(),getppid(),getpgid(0),getsid(0));
        setsid();//成立新会话
        while(1);
        return 1;
    }else{
        printf("I am parent %d,ppid=%d,pgid=%d,sid=%d\n",getpid(),getppid(),
        getpgid(0),getsid(0));
        while(1);
        return 0;
    }
}